<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>原生 js，不加载音乐，页面启动后直接播放</title>
    </head>
    <body>
        <h1>原生 js，不加载音乐，页面启动后直接播放</h1>
        <audio id="bgmusic" src="bgmusic.mp3" preload="auto" loop></audio>
        <script src="js/common.js"></script>
        <script>
            function playBackgroundMusic() {
                makeLog('play');
                var bgMusic = document.getElementById('bgmusic');
                bgMusic.play();
            }

            playBackgroundMusic();
        </script>
    </body>
</html>
